package com.brkj.model;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import com.brkj.util.MyApplication;

import java.io.Serializable;

public class DS_MyInfo implements Serializable{
	public  int userID;
	public  String userAcount;
	public  String name;
	public  String gender;
	public  String post;
	public  String department;
	public String team;
	public String headUrl;
	public String email;
	public int jifen;
	
	
	public int getJifen() {
		return jifen;
	}

	public void setJifen(int jifen) {
		this.jifen = jifen;
	}

	public int getUserID() {
		return userID;
	}

	public void setUserID(int userID) {
		this.userID = userID;
	}

	public String getUserAcount() {
		return userAcount;
	}

	public void setUserAcount(String userAcount) {
		this.userAcount = userAcount;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getPost() {
		return post;
	}

	public void setPost(String post) {
		this.post = post;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getTeam() {
		return team;
	}

	public void setTeam(String team) {
		this.team = team;
	}


	public String getHeadUrl() {
		return headUrl;
	}

	public void setHeadUrl(String headUrl) {
		this.headUrl = headUrl;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void saveInfo(){
		Context context = MyApplication.getContext();
		
		SharedPreferences sharedPreferences = context.getSharedPreferences(
				"userInfo", context.MODE_PRIVATE);
		Editor editor = sharedPreferences.edit();
		
		editor.putInt("userID", userID);
		editor.putString("userAcount", userAcount);
		editor.putString("name", name);
		editor.putString("gender", gender);
		editor.putString("post", post);
		editor.putString("department", department);
		editor.putString("team", team);
		editor.putString("headurl", headUrl);
		editor.putString("email", email);
		editor.commit();
	}
	
	public  void readInfo(){
		Context context = MyApplication.getContext();
		
		SharedPreferences sharedPreferences = context.getSharedPreferences(
				"userInfo", context.MODE_PRIVATE);
		userID = sharedPreferences.getInt("userID", 0);
		userAcount = sharedPreferences.getString("userAcount", "");
		name = sharedPreferences.getString("name", "");
		gender = sharedPreferences.getString("gender", "");
		post = sharedPreferences.getString("post", "");
		department = sharedPreferences.getString("department", "");
		team = sharedPreferences.getString("team", "");
		headUrl = sharedPreferences.getString("headurl", "");
		email = sharedPreferences.getString("email", "");
	}
	
	public void deleteInfo(){
		Context context = MyApplication.getContext();
		
		SharedPreferences sharedPreferences = context.getSharedPreferences(
				"userInfo", context.MODE_PRIVATE);
		Editor editor = sharedPreferences.edit();
		
		editor.putInt("userID", 0);
		editor.putString("userAcount", "");
		editor.putString("name", "");
		editor.putString("gender", "");
		editor.putString("post", "");
		editor.putString("department", "");
		editor.putString("team", "");
		editor.putString("headurl", "");
		editor.putString("email", "");
		editor.commit();
	}
	

}
	
